package br.com.winesys.geta.databinding.component.table.renderers;

import java.awt.Component;
import javax.swing.JCheckBox;
import javax.swing.JTable;

public class BooleanTableCellRenderer extends NoBorderTableCellRenderer {

  public BooleanTableCellRenderer() {
  }

  @Override
  public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    JCheckBox renderer = new JCheckBox();
    renderer.setAlignmentX(CENTER);
    renderer.setOpaque(false);
    renderer.setSelected(Boolean.TRUE.equals(value));
    if (isSelected) {
      renderer.setBackground(table.getSelectionBackground());
    } else {
//      renderer.setBackground(table.getBackground());
    }
    return renderer;
  }
}
